package com.max.xihu.patterns.responsible.validator;

import java.util.Map;

/**
 * @Author: Max
 * @Date: 2020-09-20 14:41
 * @Description:基础校验器
 */
public abstract class BaseValidator {

    private BaseValidator validator;

    public BaseValidator nextValidator(BaseValidator next){
        this.validator = next;
        return next;
    }

    public abstract boolean check(Map<String,Object> form);

    protected boolean checkNext(Map<String,Object> form){
        if (validator == null){
            return true;
        }
        return validator.check(form);
    }
}
